import time


def read2list(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data


m1 = read2list("m1_sorted.txt")
m2 = read2list("m2_reverse.txt")
m3 = read2list("m3_shuffle.txt")
t_start = time.time()
for i in range(4999):
    for j in range(4999 - i):
        if m1[j] > m1[j + 1]:
            m1[j], m1[j + 1] = m1[j + 1], m1[j]
t_finish = time.time()
print("Время", round((t_finish - t_start) * 1000))
t2_start = time.time()
for i in range(4999):
    for j in range(4999 - i):
        if m2[j] > m2[j + 1]:
            m2[j], m2[j + 1] = m2[j + 1], m2[j]
t2_finish = time.time()
print("Время", round((t2_finish - t2_start) * 1000))
t3_start = time.time()
for i in range(4999):
    for j in range(4999 - i):
        if m3[j] > m3[j + 1]:
            m3[j], m3[j + 1] = m3[j + 1], m3[j]
t3_finish = time.time()
print("Время", round((t3_finish - t3_start) * 1000))
